home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
math
/
nrpas13
/
mdian1.pas
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Pascal/Delphi Source File
|
1991-04-29
|
329 b
|
14 lines
PROCEDURE mdian1(VAR x: narray; n: integer; VAR xmed: real);
(* Program using routine MDIAN1 must define the type
TYPE
narray = ARRAY [1..n] OF real;
in the calling routine *)
VAR
n2: integer;
BEGIN
sort(n,x);
n2 := n DIV 2;
IF (2*n2 = n) THEN xmed := 0.5*(x[n2]+x[n2+1])
ELSE xmed := x[n2+1]
END;